package com.wgh.demo.ai.service;

import com.wgh.demo.ai.entity.Stock;
import org.springframework.data.domain.Page;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;

public interface StockService {
    List<Stock> findAll();
    Page<Stock> findAll(int page, int size);
    Flux<Stock> findAllReactive(int page, int size);
    Mono<Page<Stock>> findAllReactivePage(int page, int size);
    Flux<Stock> findAllReactiveWithoutPagination();
    Stock findById(Long id);
    Stock save(Stock stock);
    void deleteById(Long id);
    boolean existsByCode(String code);

    // 导入CSV文件中的股票数据
    ImportResult importStocksFromCsv(byte[] csvData);

    // 导入结果类
    class ImportResult {
        private int successCount;
        private int failCount;

        public ImportResult(int successCount, int failCount) {
            this.successCount = successCount;
            this.failCount = failCount;
        }

        public int getSuccessCount() {
            return successCount;
        }

        public int getFailCount() {
            return failCount;
        }
    }
}